package com.bootdo.system.service.impl;

import com.bootdo.system.dao.DlTradeClassDao;
import com.bootdo.system.domain.DlTradeClassDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.bootdo.system.dao.DlTradeDao;
import com.bootdo.system.domain.DlTradeDO;
import com.bootdo.system.service.DlTradeService;



@Service
public class DlTradeServiceImpl implements DlTradeService {
	@Autowired
	private DlTradeDao dlTradeDao;
	@Autowired
	private DlTradeClassDao dlTradeClassDao;

	@Override
	public DlTradeDO get(Integer tradeId){
		return dlTradeDao.get(tradeId);
	}
	
	@Override
	public List<DlTradeDO> list(Map<String, Object> map){
		List<DlTradeDO> list = dlTradeDao.list(map);
		for (DlTradeDO tradeDO:list) {
			DlTradeClassDO dlTradeClassDO = dlTradeClassDao.get(tradeDO.getTradeClassId());
			tradeDO.setTradeClassTitle(dlTradeClassDO.getTitle());
		}
		return list;
	}
	
	@Override
	public int count(Map<String, Object> map){
		return dlTradeDao.count(map);
	}
	
	@Override
	public int save(DlTradeDO dlTrade){
		return dlTradeDao.save(dlTrade);
	}
	
	@Override
	public int update(DlTradeDO dlTrade){
		return dlTradeDao.update(dlTrade);
	}
	
	@Override
	public int remove(Integer tradeId){
		return dlTradeDao.remove(tradeId);
	}
	
	@Override
	public int batchRemove(Integer[] tradeIds){
		return dlTradeDao.batchRemove(tradeIds);
	}
	
}
